<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script src="./js/zepto.min.js"></script>
    <script>
        function getQueryString() {
            var qs = location.search.substr(1), // 获取url中"?"符后的字串  
                args = {}, // 保存参数数据的对象
                items = qs.length ? qs.split("&") : [], // 取得每一个参数项,
                item = null,
                len = items.length;

            for (var i = 0; i < len; i++) {
                item = items[i].split("=");
                var name = decodeURIComponent(item[0]),
                    value = decodeURIComponent(item[1]);
                if (name) {
                    args[name] = value;
                }
            }
            return args;
        }
        $(function () {
            var queryObj = getQueryString();
            var code = queryObj['code']
            alert(code);
            $.get('/code', {
                code: code
            }, function (data) {
                var obj = JSON.parse(data)
                alert(obj.nickname)
            })
        })
    </script>
</body>

</html>